export const pickerOptions = {
  disabledDate(time) {
    return time.getTime() < new Date(new Date().toLocaleDateString()).getTime()
  },
  shortcuts: [
    {
      text: '近7天',
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 6)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: '近30天',
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 29)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: '近60天',
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 59)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: '近90天',
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 89)
        picker.$emit('pick', [start, end])
      }
    }
  ]
}

export const pickerOptionsS = { // 精确到秒
  disabledDate(time) {
    return time.getTime() < new Date(new Date().toLocaleDateString()).getTime()
  },
  shortcuts: [
    {
      text: '近7天',
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 7)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: '近30天',
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 30)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: '近60天',
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 60)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: '近90天',
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 90)
        picker.$emit('pick', [start, end])
      }
    }
  ]
}
